package org.enlongWu.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.enlongWu.pojo.Role;
import org.enlongWu.pojo.User;

import java.util.List;

@Mapper
public interface RoleMapper {

    @Select("select * from roles where role=#{roleStr}")
    Role findByRolestr(String roleStr);

    //添加
    @Insert("insert into roles(role,rolename,create_time,update_time)" +
            " values(#{role},#{password},now(),now()")
    void add(String username, String password);

    //好像不需要这个方法
    @Update("update roles set role=#{role},rolename=#{rolename},update_time=#{updateTime} where id = #{id}")
    void update(Role role);

    List<Role> list(String searchString);

    List<Role> getPrivilegeRoles(Role role);
}
